package c.a.a.z.b;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import c.a.a.b0.e;
import c.a.a.b0.k.m;
import c.a.a.c;
import c.a.a.e0.f;
import c.a.a.l;
import c.a.a.q;
import c.a.a.z.a;
import c.a.a.z.c.a.b;
import c.a.a.z.c.p;
import com.pgl.sys.ces.out.ISdkLite;
import java.util.ArrayList;
import java.util.List;

/* compiled from: FillContent */
public class g implements e, b, k {
    public final Path a;
    public final Paint b = new a(1);
    public final c.a.a.b0.l.b c;
    public final String d;
    public final boolean e;
    public final List<m> f = new ArrayList();
    public final c.a.a.z.c.a<Integer, Integer> g;
    public final c.a.a.z.c.a<Integer, Integer> h;
    public c.a.a.z.c.a<ColorFilter, ColorFilter> i;
    public final l j;

    public g(l lVar, c.a.a.b0.l.b bVar, m mVar) {
        Path path = new Path();
        this.a = path;
        this.c = bVar;
        this.d = mVar.c;
        this.e = mVar.f;
        this.j = lVar;
        if (mVar.d == null || mVar.e == null) {
            this.g = null;
            this.h = null;
            return;
        }
        path.setFillType(mVar.b);
        c.a.a.z.c.a a = mVar.d.a();
        this.g = a;
        a.a.add(this);
        bVar.e(a);
        a = mVar.e.a();
        this.h = a;
        a.a.add(this);
        bVar.e(a);
    }

    public String a() {
        return this.d;
    }

    public void b(RectF rectF, Matrix matrix, boolean z) {
        this.a.reset();
        for (int i = 0; i < this.f.size(); i++) {
            this.a.addPath(((m) this.f.get(i)).h(), matrix);
        }
        this.a.computeBounds(rectF, false);
        rectF.set(rectF.left - 1.0f, rectF.top - 1.0f, rectF.right + 1.0f, rectF.bottom + 1.0f);
    }

    public void c() {
        this.j.invalidateSelf();
    }

    public void d(List<c> list, List<c> list2) {
        for (int i = 0; i < list2.size(); i++) {
            c cVar = (c) list2.get(i);
            if (cVar instanceof m) {
                this.f.add((m) cVar);
            }
        }
    }

    public void f(e eVar, int i, List<e> list, e eVar2) {
        f.f(eVar, i, list, eVar2, this);
    }

    public void g(Canvas canvas, Matrix matrix, int i) {
        if (!this.e) {
            c.a.a.z.c.b bVar = (c.a.a.z.c.b) this.g;
            this.b.setColor(bVar.j(bVar.a(), bVar.c()));
            int i2 = 0;
            this.b.setAlpha(f.c((int) ((((((float) i) / 255.0f) * ((float) ((Integer) this.h.e()).intValue())) / 100.0f) * 255.0f), 0, ISdkLite.REGION_UNSET));
            c.a.a.z.c.a aVar = this.i;
            if (aVar != null) {
                this.b.setColorFilter((ColorFilter) aVar.e());
            }
            this.a.reset();
            while (i2 < this.f.size()) {
                this.a.addPath(((m) this.f.get(i2)).h(), matrix);
                i2++;
            }
            canvas.drawPath(this.a, this.b);
            c.a("FillContent#draw");
        }
    }

    public <T> void i(T t, c.a.a.f0.c<T> cVar) {
        c.a.a.z.c.a aVar;
        c.a.a.f0.c cVar2;
        if (t == q.a) {
            aVar = this.g;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == q.d) {
            aVar = this.h;
            cVar2 = aVar.e;
            aVar.e = cVar;
        } else if (t == q.C) {
            aVar = this.i;
            if (aVar != null) {
                this.c.u.remove(aVar);
            }
            if (cVar == null) {
                this.i = null;
                return;
            }
            p pVar = new p(cVar, null);
            this.i = pVar;
            pVar.a.add(this);
            this.c.e(this.i);
        }
    }
}
